import 'package:flutter/material.dart';

class DetialPage extends StatelessWidget {
  const DetialPage({super.key});

  // final String title;
  @override
  Widget build(BuildContext context) {
    final Map<String, dynamic> params =
        ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>;
    print(params);
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text('详情页'),
      ),
      body: Center(
        child: Column(
          children: [
            const Text('详情页'),
            ElevatedButton(
                onPressed: () {
                  Navigator.pop(context);
                },
                child: const Text('回到首页')),
            ElevatedButton(
                onPressed: () {
                  showDialog(
                      context: context,
                      builder: (context) {
                        return AlertDialog(
                          title: const Text('弹窗标题'),
                          content: const Text('弹窗内容'),
                          actions: [
                            ElevatedButton(
                                onPressed: () {
                                  Navigator.pop(context);
                                },
                                child: const Text('取消')),
                            ElevatedButton(
                                onPressed: () {
                                  Navigator.pop(context);
                                  Navigator.pop(context);
                                },
                                child: const Text('确定'))
                          ],
                        );
                      });
                },
                child: const Text('展示弹窗'))
          ],
        ),
      ),
    );
  }
}
